package com.gopay.common.cps.dao.fund;

import com.gopay.common.base.dao.BaseDAO;
import com.gopay.common.domain.cps.CpsGenMainOrder;
import com.gopay.common.domain.cps.CpsGenPayOrder;
import com.gopay.common.domain.fund.FundGopayCpsGenOrder;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;

/**
 * @author baiyunpeng
 * @2016年7月14日 下午3:36:05  www.gopay.com.cn Inc.All rights reserved.
 */
public interface FundCpsOrderDao  extends BaseDAO<FundGopayCpsGenOrder, String> {

    /**
     * 批量插入
     * @param connection
     * @param orderList
     * @throws SQLException
     */
     void batchInsertMainOrders(Connection connection, final List<FundGopayCpsGenOrder> orderList)throws SQLException;


    /**
     * 更新主从订单通用方法
     * @param maps
     * @return
     */
     Integer updateFundMainOrder(Map<String,Object> maps);
     Integer updateMainOrder(Map<String,Object> maps);


    /**
     * 根据差异文件更新订单
     * @param maps
     * @return
     */
     Integer updateFundOrderCauseDiffer(Map<String,Object> maps,boolean flag);
     Integer updateMainOrderCauseDiffer(Map<String,Object> maps,boolean flag);

    /**
     * 更新基金订单
     * @param fundGopayCpsGenOrder
     */
    void updateFundOrderCauseDifferByOrders(Map<String, Object> fundGopayCpsGenOrder);

    /**
     * 更新主订单
     * @param fundGopayFileEntity
     */
    void updateMainOrderCauseDifferByOrders(Map<String, Object> fundGopayFileEntity);

    /**
     * 批量插入
     * @param cpsGenPayOrderList
     */
    void batchInsertPayOrders(List<CpsGenPayOrder> cpsGenPayOrderList);

    /**
     * 根据订单号查找基金订单
     * @param gopayOrderId 国付宝订单号
     * @return
     */
    FundGopayCpsGenOrder getFundGopayOrder(String gopayOrderId);

    /**
     * 获取基金订单
     * @param gopayOrderId
     * @return
     */
    @Deprecated
    FundGopayCpsGenOrder getFundOrderRemaker2ByGopayId(String gopayOrderId);

    /**
     * 获取主订单
     * @param remark2
     * @return
     */
    List<FundGopayCpsGenOrder> getFundOrderByRemaker2(String remark2);

    /**
     * 获取主订单
     * @param releveGopayId
     * @return
     */
    FundGopayCpsGenOrder getFundOrderByReleveGopayId(String releveGopayId);

    /**
     * 更新00700订单
     * @param map
     */
    void update00700AllOrder(Map<String,Object> map);

    /**
     * 更新基金订单
     * @param paraMap
     */
    void updateGoTransFundOrder(Map paraMap);

    /**
     * 更新基金的02018或02012订单
     * @param gopayId
     * @param orderType
     */
    void updateFundCpsMainOrderTypeByGopayOrderId(String gopayId,String orderType);

    /**
     * 根据主订单更新子订单状态
     * @param merMaker2
     * @param orderType
     */
    void updateFundCpsOrderStateByMermaker2(String merMaker2,String orderType);

    /**
     * 更新主从订单
     * @param cpsGenMainOrder
     * @param fundGopayCpsGenOrder
     */
    void updateMainOrderAndFundOrder(CpsGenMainOrder cpsGenMainOrder, FundGopayCpsGenOrder fundGopayCpsGenOrder);
}
